/**
 * 
 */
package com.delta.rafg.core.constants;


import com.delta.rafg.coredata.AObject;
import com.delta.rafg.coredata.ClientData;


/**
 * @author RAFG Development Team (D9785692)
 */
public class RAFGText extends AObject {

    private static final long serialVersionUID = 5446391087709069494L;

    public static RAFGText UNKNOWN = new RAFGText("UNKNOWN ERROR");

    public static RAFGText NO_LOYALTY_ID =
        new RAFGText("NO LOYALTY ID ENTERED");

    public static RAFGText NO_LAST_NAME = new RAFGText(
        "LAST NAME IS NOT ENTERED");

    public static RAFGText NO_TICKET_NUMBER = new RAFGText(
        "TICKET NUMBER IS NOT ENTERED");

    private String code;

    public RAFGText(final String pCode) {

        setCode(pCode);
    }

    public String getCode() {

        return code;
    }

    public String getMessage(final ClientData pClientData) {

        return RAFGResourceBundle.getMessage(getCode(), pClientData);
    }

    private void setCode(String code) {

        if (code == null) {
            code = UNKNOWN.getCode();
        }
        this.code = code;
    }
}
